﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ProvincesManagement.aspx.cs"
    Inherits="WebApplication.Restricted.Management.Dictionaries.ProvincesManagement" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Assembly="System.Web.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
    Namespace="System.Web.UI.WebControls" TagPrefix="asp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1">
        <%--        <ajaxsettings>
            <telerik:AjaxSetting AjaxControlID="ProvincesGrid">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="ProvincesGrid" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </ajaxsettings>--%>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Default">
    </telerik:RadAjaxLoadingPanel>
    <telerik:RadGrid ID="ProvincesGrid" runat="server" AllowFilteringByColumn="True"
        AllowPaging="True" AllowSorting="True" AutoGenerateDeleteColumn="True" AutoGenerateEditColumn="True"
        GridLines="None" Skin="WebBlue" OnDeleteCommand="ProvincesGrid_DeleteCommand"
        OnInsertCommand="ProvincesGrid_InsertCommand" OnUpdateCommand="ProvincesGrid_UpdateCommand"
        DataSourceID="EntityDataSource1" ShowGroupPanel="true">
        <mastertableview autogeneratecolumns="False" datakeynames="Id" commanditemdisplay="Top"
            editmode="EditForms" datasourceid="EntityDataSource1" grouploadmode="Server">
            <RowIndicatorColumn>
                <HeaderStyle Width="20px"></HeaderStyle>
            </RowIndicatorColumn>
            <ExpandCollapseColumn>
                <HeaderStyle Width="20px"></HeaderStyle>
            </ExpandCollapseColumn>
            <Columns>
                <telerik:GridBoundColumn DataField="Id" DataType="System.Int32" HeaderText="Id" ReadOnly="True"
                    SortExpression="Id" UniqueName="Id">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Name" HeaderText="Nazwa" SortExpression="Name"
                    UniqueName="Name">
                </telerik:GridBoundColumn>
            </Columns>
            <NestedViewSettings DataSourceID="EntityDataSource2">
                <ParentTableRelation>
                    <telerik:GridRelationFields DetailKeyField="Id" MasterKeyField="Id" />
                </ParentTableRelation>
            </NestedViewSettings>
            <NestedViewTemplate>
                <telerik:RadTabStrip runat="server" ID="TabStrip1" MultiPageID="RadMultiPage1" SelectedIndex="0">
                    <tabs>
                        <telerik:RadTab runat="server" Text="Pierwsza" PageViewID="RadPageView1">
                        </telerik:RadTab>
                        <telerik:RadTab runat="server" Text="Druga" PageViewID="RadPageView2">
                        </telerik:RadTab>
                        <telerik:RadTab runat="server" Text="Trzecia" PageViewID="RadPageView3">
                        </telerik:RadTab>
                    </tabs>
                </telerik:RadTabStrip>
                <telerik:RadMultiPage ID="RadMultiPage1" runat="server" SelectedIndex="0" >
                    <telerik:RadPageView ID="RadPageView1" runat="server">
                    Treść pierwszej zakładki
                    Nazwa: <asp:Label ID="Label1" runat="server" Text='<%# Bind("Name") %>'></asp:Label><br />
                    Id: <asp:Label ID="Label4" runat="server" Text='<%# Bind("Id") %>'></asp:Label><br />
                    <telerik:RadGrid ID="CitiesGrid" runat="server" AllowFilteringByColumn="True"
                        AllowSorting="True" AllowPaging="True" GridLines="None"
                        Skin="WebBlue" DataSourceID="CitiesEntityDataSource">
                        <MasterTableView AutoGenerateColumns="False" DataSourceID="CitiesEntityDataSource">
                            <RowIndicatorColumn>
                                <HeaderStyle Width="20px"></HeaderStyle>
                            </RowIndicatorColumn>
                            <ExpandCollapseColumn>
                                <HeaderStyle Width="20px"></HeaderStyle>
                            </ExpandCollapseColumn>
                            <Columns>
                                <telerik:GridBoundColumn DataField="Id" DataType="System.Int32" HeaderText="Id" SortExpression="Id"
                                    UniqueName="Id">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="Name" HeaderText="Name" SortExpression="Name"
                                    UniqueName="Name">
                                </telerik:GridBoundColumn>
                            </Columns>
                        </MasterTableView>
                    </telerik:RadGrid>
                    <asp:EntityDataSource ID="CitiesEntityDataSource" runat="server" ConnectionString="name=MerchModelEntities"
                        DefaultContainerName="MerchModelEntities" CommandText="select city.Id as Id, city.Name as Name, province.Id as ProvinceId from MerchModelEntities.City as city join MerchModelEntities.Province as province on city.Province = province where province.Id == @Id"
                        Select="it.[Id], it.[Name], it.[ProvinceId]" OrderBy="it.[Id]">
                        <SelectParameters>
                            <asp:ControlParameter ControlID="Label4" PropertyName="Text" Type="Int32" Name="Id" />
                        </SelectParameters>
                    </asp:EntityDataSource>
                    </telerik:RadPageView>
                    <telerik:RadPageView ID="RadPageView2" runat="server">
                    Treść drugiej zaklądki
                    Nazwa: <asp:Label ID="Label2" runat="server" Text='<%# Bind("Name") %>'></asp:Label><br />
                    </telerik:RadPageView>
                    <telerik:RadPageView ID="RadPageView3" runat="server">
                    Treść trzeciej zakładki
                    Nazwa: <asp:Label ID="Label3" runat="server" Text='<%# Bind("Name") %>'></asp:Label><br />
                    </telerik:RadPageView>
                </telerik:RadMultiPage>
                <%--Nazwa: <asp:Label ID="ProvinceNameDetails" runat="server" Text='<%# Bind("Name") %>'></asp:Label><br />--%>
            </NestedViewTemplate>
            <EditFormSettings EditFormType="WebUserControl" UserControlName="~/Controls/Management/Dictionaries/ProvinceEditControl.ascx">
                <EditColumn UniqueName="EditCommandColumn1">
                </EditColumn>
            </EditFormSettings>
        </mastertableview>
    </telerik:RadGrid>
    <asp:EntityDataSource ID="EntityDataSource1" runat="server" ConnectionString="name=MerchModelEntities"
        DefaultContainerName="MerchModelEntities" EntitySetName="Province" 
        OnSelecting="EntityDataSource1_Selecting">
    </asp:EntityDataSource>
    <asp:EntityDataSource ID="EntityDataSource2" runat="server" ConnectionString="name=MerchModelEntities"
        DefaultContainerName="MerchModelEntities" CommandText="select province.Id as Id, province.Name as Name from MerchModelEntities.Province as province"
        Select="it.[Id], it.[Name]" OrderBy="it.[Id]" Where="it.[Id] == @Id">
        <WhereParameters>
            <asp:Parameter Name="Id" Type="Int32" />
        </WhereParameters>
    </asp:EntityDataSource>
    
    <asp:Label ID="MojaLabelka" runat="server" Text="1"></asp:Label><br />
    </form>
</body>
</html>
